package com.example.demo.service.impl;

import com.example.demo.mapper.HexEnvMapper;
import com.example.demo.entity.HexEnv;
import com.example.demo.service.HexEnvService;
import com.example.demo.utils.DateToStamp;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HexEnvServiceImpl implements HexEnvService {

    @Resource
    HexEnvMapper hexEnvMapper;

    @Override
    public void insertHexEnv(HexEnv hexEnv) {
        hexEnv.setCreateTime(DateToStamp.getTimeStamp());
        hexEnv.setUpdateTime(DateToStamp.getTimeStamp());
        hexEnvMapper.insertHexEnv(hexEnv);
    }

    @Override
    public void updateHexEnv(HexEnv hexEnv) {
        hexEnv.setUpdateTime(DateToStamp.getTimeStamp());
        hexEnvMapper.updateHexEnv(hexEnv);
    }

    @Override
    public HexEnv getHexEnvById(int id) {
        return hexEnvMapper.getHexEnvById(id);
    }

    @Override
    public List<HexEnv> getAllHexEnvList() {
        return hexEnvMapper.getAllHexEnv();
    }
}
